/**
 * Created by alan on 2017/5/16.
 * 水资源分区
 */
Ext.define('Admin.view.baseInfo.ddsBWrz', {
	extend: 'Ext.container.Container',
	xtype: 'ddsBWrz',
	requires: [
		'Admin.store.baseInfo.DdsBWrz'
	],
	//起别名
	alias: 'ddsBWrz',
	controller: 'ddsBWrzController',
	userCLs: 'big-100 small-100',
	margin: 7,
	bodyPadding: 7,
	layout: {
		type: 'vbox',
		align: 'stretch' //拉伸使其充满整个父容器
	},
	height: 200,
	autoLoad: true,
	items: [{
		xtype: 'panel',
		height: 50,
		items: [{
			tbar: [
//				{
//					xtype: "textfield",
//					maxWidth: 220,
//					fieldLabel: "水资源分区名称",
//					labelWidth: 100,
//					reference: "wrzNm"
//				},
				{
					xtype: "combobox",
					width: 400,
					fieldLabel: "水资源分区名称",
					reference: "wrzNm",
					displayField: 'wrzNm',
					queryMode: 'local',
					valueField: 'wrzNm',
					triggerAction: 'all',
					anyMatch: true,
					labelWidth: 120,
					listeners: {
						added: function(combo) {
							var _that = this;
							var store = Ext.create("Ext.data.Store", {
								autoLoad: true,
								proxy: {
									type: "ajax",
									url: config.URL+"szy/info/ddsBWrz/list",
									extraParams: {
										river: config.RIVER
									},
									reader: {
										type: 'json',
										rootProperty: 'list',
										totalProperty: 'count'
									}
								}
							});
							combo.setStore(store);
						}
					}
				},
				{
					xtype: "button",
					text: "查询",
					iconCls: 'x-fa  fa-file-o',
					handler: 'check',
					margin: '0 10 0 10',
					// style: 'background-color:#108ee9; border-radius:4px;-webkit-border-radius: 4px;',
					style: 'border-radius:4px;-webkit-border-radius: 4px;'
				}
			],
			margin: '0 0 10 0'
		}, ]
	}, {
		xtype: 'gridpanel',
		title: '水资源分区',
		flex: 1,
		scrollable: true,
		reference: 'ddsBWrzGrid',
		columns: [{
				header: '水资源分区代码',
				dataIndex: 'wrzCd',
				/** editor: 'textfield' ,*/ align: 'center',
				width: '15%'
			},
			{
				header: '水资源分区名称',
				dataIndex: 'wrzNm',
				/** editor: 'textfield' ,*/ align: 'center',
				width: '20%'
			},
			{
				header: '水资源分区面积(km&sup2;)',
				dataIndex: 'wrzA',
				/** editor: 'textfield' ,*/ align: 'center',
				width: '20%'
			},
			{
				header: '多年平均降水量(mm)',
				dataIndex: 'avgP',
				/** editor: 'textfield' ,*/ align: 'center',
				width: '11%'
			},
			{
				header: '多年平均水资源总量(亿m&sup3;)',
				dataIndex: 'avgWat',
				/** editor: 'textfield' ,*/ align: 'center',
				width: '11%'
			},
			{
				header: '多年平均地表水资源量(亿m&sup3;)',
				dataIndex: 'avgSurfWat',
				/** editor: 'textfield' ,*/ align: 'center',
				width: '11%'
			},
			{
				header: '多年平均地下水资源量(亿m&sup3;)',
				dataIndex: 'avgGwWat',
				/** editor: 'textfield' ,*/ align: 'center',
				width: '11.7%'
			}
		],
		store: {
			type: 'ddsBWrz'
		},
		bbar: {
			xtype: 'pagingtoolbar',
			displayInfo: true,
			displayMsg: "显示从第{0}条数据到第{1}条数据，共{2}条数据",
			emptyMsg: "没有记录",
		},
		stripeRows: true,
		columnLines: true,
		plugins: {
			ptype: 'cellediting',
			clicksToEdit: 1
		}
	}]
})